package com.calciominoBeta.Activity.db;

import java.util.ArrayList;

import com.calciominoBeta.Entity.InfoOj;
import com.calciominoBeta.Util.Util;
import com.telpoo.frame.database.BaseDBSupport;
import com.telpoo.frame.object.BaseObject;

import android.content.Context;

public class DbSupport {
	
	public static void initDb(Context context){
		
		BaseDBSupport.init(TableDb.tables, TableDb.keys, context, TableDb.pathDbName	, 2);
		
	}
	
	public static ArrayList<InfoOj> getCache(String table){
		ArrayList<BaseObject> ojs = BaseDBSupport.getAllOfTable(table);
		return Util.convertOj(ojs);
		
	}
	
	public static void saveCache(ArrayList<BaseObject> ojs,String table){
		BaseDBSupport.removeAllInTable(table);
		BaseDBSupport.addToTable(ojs,table);
		
	}
	
}
